package com.cwz.taculture.service.mall.impl;

import com.cwz.taculture.mapper.mall.MallMapper;
import com.cwz.taculture.pojo.CommodityPojo;
import com.cwz.taculture.service.mall.MallService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class Mall_ServiceImpl implements MallService {

    /**
     *
     */
    @Autowired
    private MallMapper mall_mapper;

    /**
     * Mall页面查询 根据分类,尺寸,价格进行模糊查询
     *
     * @param
     */
    @Override
    public PageInfo<CommodityPojo> findCommodityByMall(CommodityPojo commodityPojo) {
        if(commodityPojo.getPage()==null){
            commodityPojo.setPage(0);
        }
        PageHelper.startPage(commodityPojo.getPage(),2);
        List<CommodityPojo> list = mall_mapper.findCommodityByMall(commodityPojo);
        PageInfo<CommodityPojo> pageInf = new PageInfo<CommodityPojo>(list);
        return pageInf;
    }
}
